package tdd.refactor;

public class TaxiFeeTime {
	private Chargeable chDaylight;
	private Chargeable chNight;
	/**
	 * @param chDaylight
	 * @param chNight
	 */
	public TaxiFeeTime(Chargeable chDaylight, Chargeable chNight) {
		super();
		this.chDaylight = chDaylight;
		this.chNight = chNight;
	}
	
	public Chargeable CreateTaxiFeeCharger(int time) {
		if(isNight(time)) {
			return this.chNight;
		} else {
			return this.chDaylight;
		}
	}
	
	 private boolean isNight(int time) {
		 return time < 6||time >=23;
	}
}
